package com.itheima.cases;

public class TextDemo7 {
    public static void main(String[] args) {
        System.out.println("当前素数的个数是："+search(101, 200));
    }

    public static int search(int a, int b) {
        int sum = 0;
        for (int i = a; i <= b; i++) {
            boolean flag = true;
            for (int j = 2; j <= i / 2; j++) {
                if (i % j == 0) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                System.out.println(i);
                sum++;
            }
        }
        return sum;
    }
}
